<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>将元素属性的值作为 html 解析并显示</title>
</head>
<body>

<div id="change" class="change">
  <div html="<h1>Hello, Vue!</h1>" style="background-color: red">Hello, World!</div>
  <div html="<h1>Hello, Vue!</h1>" style="background-color: green">Hello, World!</div>
</div>

<script>
  let elements = document.querySelectorAll("#change > div");
  for (let i = 0; i < elements.length; i++) {
    let attribute = elements[i].getAttribute("html");
    elements[i].innerHTML = attribute;
  }
</script>
</body>
</html>